<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <input type="text" class="mobile">
    <script>
        var inputDom  = document.querySelector('.mobile');
        inputDom.onkeydown = function(){
            console.log('键盘按下事件')
        }
        inputDom.onkeyup = function(){
            console.log('键盘抬起')
        }
        // onkeypress 也是表示键盘的按下事件 功能性按键onkeypress 无法触发的
        inputDom.onkeypress = function(){
            console.log('press')
        }
    </script>
</body>
</html>